{template 'admin_header'}

{if $operation == 'display'}
<form method="post" action="" id="listform">
	<div class="admin">
  <div class="panel admin-panel">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
        <li> <a class="button border-main icon-plus-square-o" href="{php echo $this->createMobileUrl('admin_power', array('op' => 'add'))}"> 添加内容</a> </li>
        <li>搜索：</li>
        
       
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
        <th width="100" style="text-align:left; padding-left:20px;">ID</th>
        <th width="10%">部门</th>
        <th>姓名</th>
        <th>学号</th>
        <th>学院</th>
        <th>班级</th>
        <th>时间</th>
        <th width="310">操作</th>
      </tr>
      {loop $list $v}
        <tr>
          <td>{$v['id']}</td>
          <td>{$v['department']}</td>
          <td>{$v['name']}</td>
          <td>{$v['student_id']}</td>
          <td>{$v['collegename']}</td>
          <td>{$v['classname']}</td>
          <td>{$v['date']}</td>
          <td><div class="button-group"> <a class="button border-main" href="add.html"><span class="icon-edit"></span> 修改</a> <a class="button border-red" href="javascript:void(0)" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a> </div></td>
        </tr>
   		{/loop}
      <tr>
        <td colspan="11"><div class="pagelist"> <a href="">上一页</a> <span class="current">1</span><a href="">2</a><a href="">3</a><a href="">下一页</a><a href="">尾页</a> </div></td>
      </tr>
    </table>
  </div>
</div>
</form>

{elseif $operation == 'add'}
<div class="admin">
  <div class="panel admin-panel margin-top" id="add">
          <div class="panel-head"><strong><span class="icon-pencil-square-o"></span> 修改内容</strong></div>
          <div class="body-content">
            <form method="post" class="form-x" action="" id="myform">  
                 
              <!-- 下拉框 -->
                  <div class="form-group">
                    <div class="label">
                      <label>部门：</label>
                    </div>
                    <div class="field">
                      <select name="department" class="input w50" value="" onchange="manage_change_c(this.options[this.options.selectedIndex].value)">
                        {loop $bm $v}
                        <option value="{$v['id']}">{$v['department']}</option>
                        {/loop}
                      </select>
                      <div class="tips" title=""></div>
                    </div>
                  </div>
  
              
                  <div class="form-group">
                    <div class="label">
                      <label>学号/工号：</label>
                    </div>
                    <div class="field">
                      <input type="text" class="input w50" value=" " name="student_id" data-validate="required:请输入学号">
                      <div class="tips" title=""></div>
                    </div>
                  </div>
             
              <div class="form-group">
                <div class="label">
                  <label></label>
                </div>
                <div class="field">
  
                  <button class="button bg-main icon-check-square-o" type="button" onclick="power_add()"> 提交</button>
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>
{/if}


</body>
<script type="text/javascript">
  function power_add(){
    var formData = new FormData($("#myform")[0]);//获取表单数据  
     $.ajax({
     url: "{php echo $this->createMobileUrl('admin_power_add')}",//提交地址 
     type: 'POST',
     data: formData,
     async: false,
     cache: false,
     contentType: false,
     processData: false,
     success: function (returndata) {
         if(returndata.status=='1'){
               alert(JSON.parse(returndata).message);
               console.log(JSON.parse(returndata).data);
             }
         else{ 
             alert(JSON.parse(returndata).message);
             }
     },
      error: function (returndata) {
             alert('系统错误');
             }
         });
  }

</script>
</html>